test(postgrest): increase code coverage #651
Merged
+2,014
−125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several updates to the
PostgRESTlibrary, focusing on simplifying header and query management, improving JSON serialization, and adding comprehensive test coverage.Simplification of Header and Query Management:
Sources/PostgREST/PostgrestBuilder.swift: Simplified the logic for appending or updating thepreferheader by introducing theappendOrUpdatemethod.Sources/PostgREST/PostgrestTransformBuilder.swift: Refactored multiple methods to use theappendOrUpdatemethod for headers and query items, reducing code duplication and improving readability. [1] [2] [3] [4]JSON Serialization Improvements:
Sources/PostgREST/URLQueryRepresentable.swift: Modified thestringfymethod inJSONSerializationto return an optionalString, ensuring safer handling of JSON serialization.Addition of New Tests:
Tests/PostgRESTTests/PostgresQueryTests.swift: Added a new test suitePostgrestQueryTestswith various tests for thePostgrestClientclass, including tests for custom headers, non-success status codes, and different HTTP methods.Tests/PostgRESTTests/PostgrestBuilderTests.swift: ExtendedPostgrestBuilderTeststo include tests for custom headers, error handling, and different query options.Tests/PostgRESTTests/PostgrestQueryBuilderTests.swift: IntroducedPostgrestQueryBuilderTeststo test various query builder methods such asselect,insert,update,upsert, anddelete.